<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('access_logs', function (Blueprint $table) {
            $table->id();

            $table->string('ip', 45)->nullable()->comment('IP地址');
            $table->string('url', 255)->nullable()->comment('请求URL');
            $table->string('method', 10)->nullable()->comment('请求方法');
            $table->text('agent')->nullable()->comment('请求头');
            $table->string('referer', 255)->nullable()->comment('来源页面');

            $table->timestamps();
            $table->comment('访问日志');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('access_logs');
    }
};
